import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react';
const LayoutConsole = lazy(() => import('../pages/layout/LayoutConsole'))

const Login = lazy(() => import('../pages/security/Login'));
const Register = lazy(() => import('../pages/security/Register'));
const Forget = lazy(() => import('../pages/security/Forget'));
const Store = lazy(() => import('../pages/security/Store'));

const ProductItem = lazy(() => import('../pages/product/ProductItem'));
const ProductItemDetails = lazy(() => import('../pages/product/ProductItemDetails'));
const ProductMenu = lazy(() => import('../pages/product/ProductMenu'));
const ProductMenuDetails = lazy(() => import('../pages/product/ProductMenuDetails'));

const CartItems = lazy(() => import('../pages/cart/CartItems'));

const StaffItems = lazy(() => import('../pages/staff/StaffItems'));
const StaffDetails = lazy(() => import('../pages/staff/StaffDetails'));

const Router = createBrowserRouter([
    {
        path: "/login",
        element: <Login />,
    },
    {
        path: "/register",
        element: <Register />,
    },
    {
        path:"/forget",
        element:<Forget/>
    },
    {
        path: '/store',
        element: <Store />,
    },
    {
        path: "/",
        element: <LayoutConsole />,
        children: [
            {
                path: '/product',
                children: [
                    {
                        index: true,
                        path: "/product/items",
                        element: <ProductItem />,
                    },
                    {
                        path: "/product/items/add",
                        element: <ProductItemDetails />,
                    },
                    {
                        path: "/product/items/edit",
                        element: <ProductItemDetails />,
                    },
                    {
                        index: true,
                        path: "/product/menus",
                        element: <ProductMenu />,
                    },
                    {
                        path: "/product/menus/add",
                        element: <ProductMenuDetails />,
                    },
                    {
                        path: "/product/menus/edit",
                        element: <ProductMenuDetails />,
                    }
                ]
            },
            {
                path: '/staff',
                children: [
                    {
                        index: true,
                        path: "/staff/items",
                        element: <StaffItems />,
                    },
                    {
                        path: "/staff/details",
                        element: <StaffDetails />,
                    },
                ]
            },
            {
                path: '/cart',
                children: [
                    {
                        index: true,
                        path: "/cart/items",
                        element: <CartItems />,
                    },
                ]
            },
        ],
    }
])
export default Router;